package com.epam.OOP.cargo;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Yelena_M
 * Date: 04.08.13
 * Time: 17:07
 * To change this template use File | Settings | File Templates.
 */

/*
* Product */
public class Cargo implements Comparable{

    private int volume;
    private int price;
    private int weight;
    private List<String> parameters;

    public void setVolume(int volume) {
        this.volume = volume;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }

    public void setParameters(List<String> parameters) {
        this.parameters = parameters;
    }

    public int getVolume() {
        return volume;
    }

    public int getPrice() {
        return price;
    }

    public int getWeight() {
        return weight;
    }

    public List<String> getParameters() {
        return parameters;
    }

    @Override
    public int compareTo(Object obj) {
        int result = 0;
        if (obj instanceof Cargo) {
            Cargo entry = (Cargo) obj;
            result = volume - entry.volume;
            if (result == 0) {
                result = price - entry.price;
                if(result != 0) {
                    return result;
                }
            }
        }
        return result;
    }

    @Override
    public String toString() {
        return "Cargo{" +
                "volume=" + volume +
                ", price=" + price +
                ", weight=" + weight +
                ", parameters=" + parameters +
                '}';
    }
}
